<%--
  Created by IntelliJ IDEA.
  User: eaglet
  Date: 2024/3/15
  Time: 9:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改用户密码</title>
    <script type="text/javascript">
        function checkinput() {
            var oldpass = document.getElementById("oldpass").value;
            var newpass = document.getElementById("newpass").value;
            var renewpass = document.getElementById("renewpass").value;

            //trim()方法是去除空格，不允许输入空格内容
            if (oldpass.trim()== "" || oldpass.trim() == null) {
                alert("旧密码不能空！");
                return false;
            }

            if (newpass.trim() == "" || newpass.trim() == null) {
                alert("新密码不能为空！");
                return false;
            }

            if (renewpass.trim() == "" || renewpass.trim() == null) {
                alert("重复密码不能为空！");
                return false;
            }

            if(newpass.trim()==renewpass.trim()){
                return true;
            }else{
                alert("两次密码不一样，请重新输入");
                return false;
            }
        }
    </script>
</head>
<body>
    <div>
        <div><h3>修改密码</h3></div>
        <div>
            <form action="modifyUserPassServlet" method="post">
                <div>
                    旧密码：<input type="password" id="oldpass" name="oldpass">
                </div>
                <div>
                    新密码：<input type="password" id="newpass" name="newpass">
                </div>
                <div>
                    重复密码：<input type="password" id="renewpass" name="renewpass">
                </div>
                <div>
                    <input type="submit" onclick="return checkinput()" value="修改密码">
                </div>
            </form>
        </div>
    </div>
</body>
</html>
